/**
 * 
 */
package org.kknd.thetvdblib.pojo;

import java.util.Set;
import java.util.TreeSet;

/**
 * @author Christian
 * 
 */
public class Mirror {
    private int id;
    private String mirrorpath;
    private Set<Type> typemask;

    /**
     * @param id
     * @param mirrorpath
     * @param typemask
     */
    public Mirror(int id, String mirrorpath, Set<Type> typemask) {
        super();
        this.id = id;
        this.mirrorpath = mirrorpath;
        this.typemask = typemask;
    }

    /**
     * @return the id
     */
    public int getId() {
        return this.id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the mirrorpath
     */
    public String getMirrorpath() {
        return this.mirrorpath;
    }

    /**
     * @param mirrorpath the mirrorpath to set
     */
    public void setMirrorpath(String mirrorpath) {
        this.mirrorpath = mirrorpath;
    }

    /**
     * @return the typemask
     */
    public Set<Type> getTypemask() {
        return this.typemask;
    }

    /**
     * @param typemask the typemask to set
     */
    public void setTypemask(Set<Type> typemask) {
        this.typemask = typemask;
    }

    public void setTypemask(int typemask) {
        TreeSet<Type> newTypemask = new TreeSet<Type>();
        switch (typemask) {
        case 1:
            newTypemask.add(Type.XML);
            break;
        case 2:
            newTypemask.add(Type.BANNER);
            break;
        case 3:
            newTypemask.add(Type.XML);
            newTypemask.add(Type.BANNER);
            break;
        case 4:
            newTypemask.add(Type.ZIP);
            break;
        case 5:
            newTypemask.add(Type.XML);
            newTypemask.add(Type.ZIP);
            break;
        case 6:
            newTypemask.add(Type.BANNER);
            newTypemask.add(Type.ZIP);
            break;
        case 7:
            newTypemask.add(Type.XML);
            newTypemask.add(Type.BANNER);
            newTypemask.add(Type.ZIP);
            break;
        default:
            break;
        }
        this.typemask = newTypemask;
    }

}
